package com.rmuti.programming.ui;


import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class LoginView extends BaseView {


	public LoginView(Display display) {
		ImageRegistry registry = new ImageRegistry(display);
		registry.put("bg", ImageDescriptor.createFromFile(ResultScore.class, "../../../../icons/image/header.gif"));
		this.bgImage = registry.get("bg");
		
		this.display = display;
		this.shell = new Shell(display);
	}
	
	@Override
	public void display() {		
		shell.open();
		shell.setBounds(400, 120, 385, 390);
		createHeaderMenu();				
		createButtomMenu();
		
		Composite composite = new Composite(shell, SWT.NONE);
		composite.setBounds(0, 55, 385, 280);
		
		Label txtUserName = new Label(composite, SWT.NONE);
		txtUserName.setText("รหัส");
		txtUserName.setBounds(90, 58, 40, 30);
		
		Text userName = new Text(composite, SWT.SINGLE | SWT.BORDER);
		userName.setBounds(130, 50, 180, 30);
		
		Label txtPassWord = new Label(composite, SWT.NONE);
		txtPassWord.setText("รหัสผ่าน");
		txtPassWord.setBounds(90, 100, 40, 30);
		
		Text passWord = new Text(composite, SWT.SINGLE | SWT.BORDER);
		passWord.setBounds(130, 100, 180, 30);
		
		Button button = new Button(composite, SWT.PUSH);
		button.setText("ตกลง");
		button.setBounds(130, 140, 60, 30);
		button.addListener(SWT.Selection, new Listener() {
			
			@Override
			public void handleEvent(Event arg0) {
				
			}
		});
	}
	
	public static void main(String[] args) {
		Display display = new Display();
		LoginView view = new LoginView(display);
		view.display();

		while (!view.shell.isDisposed()) {
			if (!view.display.readAndDispatch())
				view.display.sleep();
		}
		view.display.dispose();
	}

}
